//*****************************************************************************
//* Foxit Digital Rights Management Library
//*
//* Foxit Software Inc.
//* Copyright(C) 2005-2010, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
//* and trade secrets of Foxit Software Inc.
//*****************************************************************************
/**
 * @addtogroup FDRM
 * @{
 */

/**
 * @file
 * @brief FDRM Manager.
 */

#ifndef _FDRM_MANAGER
#define _FDRM_MANAGER

//*****************************************************************************
//* FDRM manager
//*****************************************************************************
/**
 * @name FDRM manager
 */
/*@{*/

/** @brief Environment values. */
enum FDRM_ENVVALUE
{
	FDRM_ENVVALUE_MgrGUID = 0,		//GUID of FDRM manager
	FDRM_ENVVALUE_DeviceSN,			//device SN
	FDRM_ENVVALUE_DeviceName,		//device name, computer name, domain name, DNS name, etc.
	FDRM_ENVVALUE_DeviceDesc,		//device description
	FDRM_ENVVALUE_OSType,			//OS type 
	FDRM_ENVVALUE_OSVersion,		//OS version 
	FDRM_ENVVALUE_OSDesc,			//OS description 
	FDRM_ENVVALUE_CPUType,			//CPU type 
	FDRM_ENVVALUE_CPUCount,			//amount of total CPUs
	FDRM_ENVVALUE_CPUID,			//CPU ID, separate by '|' if there are several CPUs
	FDRM_ENVVALUE_MemorySize,		//total size of physical memory
	FDRM_ENVVALUE_BIOS,				//BIOS Manufacturer and version information, separate by '|'
	FDRM_ENVVALUE_MotherBoard,		//Motherboard, Product, version, serialnumber information , separate by '|'
	FDRM_ENVVALUE_HDCount,			//amount of total hard diskettes
	FDRM_ENVVALUE_HDSN,				//hard diskette SN, separate by '|' if there are several HDs
	FDRM_ENVVALUE_NICCount,			//amount of total NICs
	FDRM_ENVVALUE_MACAddr,			//MAC address, separate by '|' if there are several MAC addresses
	FDRM_ENVVALUE_UserName,			//user name
	FDRM_ENVVALUE_ProcessID,		//process ID
	FDRM_ENVVALUE_MAX				//MAX index of environment item
};

/**
 * @brief Interface for FDRM manager.
 * Application designer need derive from this interface and implement for more expanded controls.
 */
class IFDRM_Mgr : public CFDRM_Object
{
public:
	/**
	 * @brief	Check the license permission for an operator with it's version.
	 * @param[in] op	referenced operator object.
	 * @return	Return TRUE if the license is permitted, or FALSE for failure.
	 */
	virtual FX_BOOL		CheckLicense(const CFDRM_Operator &op) = 0;

	/**
	 * @brief	Retrieve environment value string. Implementation should not return empty value string, use any comfortable value instead of it.
	 * @param[in] eItem		specifies an environment item to retrieve value string, refer to FDRM_ENVVALUE enumeration.
	 * @param[in] bsValue	stores the retrieved environment value string.
	 */
	virtual void		GetEnvValue(FDRM_ENVVALUE eItem, CFX_ByteString &bsValue) = 0;
	/**
	 * @brief	Retrieve the digest value for environment values. Implementation should use SHA2 algorithm.
	 * @param[in] bsDigest	stores the digest value string.
	 */
	virtual void		GetEnvDigest(CFDRM_ByteKeyString &bsDigest) = 0;
};

/**
 * @brief	Create a default instance object for FDRM manager. Application should use derived implementation.
 * @return	Return the object pointer. Caller should call Release method to destroy this object.
 */
IFDRM_Mgr*	FDRM_Manager_CreateDef();

/**
 * @brief	Get the current instance object for FDRM manager.
 * @return	Return the current object pointer.
 */
IFDRM_Mgr*	FDRM_Manager_Get();

/**
 * @brief	Set the current instance object for FDRM manager.
 * @param[in] pMgr	Points to the object pointer, it should be not a NULL pointer.
 */
void		FDRM_Manager_Set(IFDRM_Mgr *pMgr);

/*@}*/

#endif //_FDRM_MANAGER
